package com.jianguozh.difs.framework.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * 数据库持久化基类
 *
 * @author hanrs
 * @email 4076130@qq.com
 * @since 2022/3/9 17:26
 */
@Data
@ToString
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public abstract class BaseEntity<T extends Model<T>> extends IdEntity<T> {

    private static final long serialVersionUID = -4035746430764065642L;

    public static final String CREATE_AT = "create_at";
    public static final String CREATE_DATE = "create_date";
    public static final String MODIFY_AT = "modify_at";
    public static final String MODIFY_DATE = "modify_date";
    public static final String DEL_FLAG = "del_flag";

    /**
     * 创建者
     */
    @TableField(value = "create_at", fill = FieldFill.INSERT)
    private String createAt;

    /**
     * 创建时间
     */
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    private LocalDateTime createDate;

    /**
     * 修改者
     */
    @TableField(value = "modify_at", fill = FieldFill.INSERT_UPDATE)
    private String modifyAt;

    /**
     * 修改时间
     */
    @TableField(value = "modify_date", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifyDate;

    /**
     * 删除标志
     */
    @TableField("del_flag")
    @TableLogic
    private Boolean delFlag;


}
